package cn.tedu.charging.order.timer;

import cn.tedu.charging.order.service.OrderService;
import com.xxl.job.core.context.XxlJobContext;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class OrderTimer {
    @Autowired
    private OrderService orderService;
    //按照cron定时计划 调用方法检查某张订单是否正常结束
    @XxlJob("order-status-check")
    public void orderStatusCheck(){
        //拿到任务中的参数
        String billId = XxlJobContext.getXxlJobContext().getJobParam();
        //TODO 业务调用
        log.debug("订单定时任务,开始执行,检查订单状态是否结束,billId:{}",billId);
        orderService.orderStatusCheck(billId);
    }
}
